﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;

using MovieFactory.Entity.Interface;

namespace MovieFactory.Entity {
    public class Factory {
        public static IEnumerable<IRenderer> LoadRenderers(string assembly) {
            Assembly asm = Assembly.LoadFrom(assembly);
            return asm.GetExportedTypes().Where(item=>typeof(IRenderer).IsAssignableFrom(item)).Select(type => (IRenderer)Activator.CreateInstance(type));
        }
    }
}
